import * as index from '@/api/index.js'
export default {
	data() {
		return {
			list:[],
			carTypeList:[],
			carName:''
		}
	},
	
	onShow() {
	
	},
	onLoad(option) {
		this.getCarBrandList()
	},

	methods: {
	getCarBrandList() {
		index.getCarBrandList().then(res => {
			this.list = res.data
		})
	},
	carClick(e) {
		// this.form.car = e.item.name
		// this.$refs.car.close()
		this.getCarTypeList(e.item.name)
		this.$refs.carType.open('bottom')
	},
	getCarTypeList(name) {
		index.getCarTypeList({
			brand_name: name
		}).then(res => {
			this.carName = name
			this.carTypeList = res.data
		})
	},
	carTypeClick(item, index) {
		// this.form.first = item.brand_id
		// this.form.second = item.id
		// this.form.car_model = this.carName + '/' + item.name
		let form = {}
		form.first = item.brand_id
		form.second = item.id
		form.car_model = this.carName + '/' + item.name
		uni.$emit('car',{msg:JSON.stringify(form)})
		this.$tools.back(1)
	},
	}
}